package com.gzx.spring.mq.service;

import org.springframework.stereotype.Service;

import com.gzx.risk.core.service.OrderOpService;
import com.gzx.spring.mq.pojo.RiskOpMsg;

import jakarta.annotation.Resource;

@Service
public class OrderOpServiceImpl implements OrderOpService {
	@Resource
	private RiskMqService riskMqService;

	@Override
	public void reject(Long orderId) {
		RiskOpMsg riskOpMsg = new RiskOpMsg();
		riskOpMsg.setMsgType("order.close");
		riskOpMsg.setNote("关闭订单");
		riskOpMsg.getParams().put("id", orderId);
		riskMqService.send(riskOpMsg);
	}

    @Override
    public void creditInvestigate(Long orderId) {
        RiskOpMsg riskOpMsg = new RiskOpMsg();
        riskOpMsg.setMsgType("order.creditInvestigate");
        riskOpMsg.setNote("风控一阶段通过，进入征信调查");
        riskOpMsg.getParams().put("id", orderId);
        riskMqService.send(riskOpMsg);
    }

    @Override
    public void creditReview(Long orderId, Integer yushouCount) {
        RiskOpMsg riskOpMsg = new RiskOpMsg();
        riskOpMsg.setMsgType("order.creditReview");
        riskOpMsg.setNote("风控二阶段通过，进入信审");
        riskOpMsg.getParams().put("id", orderId);
        riskOpMsg.getParams().put("yushouCount", yushouCount);
        riskMqService.send(riskOpMsg);
    }

	@Override
	public void permit(Long orderId) {
		RiskOpMsg riskOpMsg = new RiskOpMsg();
		riskOpMsg.setMsgType("order.permit");
		riskOpMsg.setNote("风控通过，进入发货");
		riskOpMsg.getParams().put("id", orderId);
		riskMqService.send(riskOpMsg);
	}
}
